import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.event.KeyEvent;


public class Interaction {
    private Point myLastMousePosition;
    private Canvas myContainer;
    private MouseReaction myMR;
    private Simulation mySim;
    public Interaction(Canvas container,Simulation sim){
        int lastKeyPressed = container.getLastKeyPressed();
        keyReaction(lastKeyPressed);
        myContainer = container;
        mySim = sim;
    }
    public void update(){
        myLastMousePosition = myContainer.getLastMousePressPosition();
        if(myLastMousePosition!=null){
            if(myMR==null){
                myMR=new MouseReaction(myContainer,mySim,myLastMousePosition);
            }
            myMR.update(myLastMousePosition);
        }else{
            myMR=null;
        }
    }
    public void paint(Graphics2D pen){
        if(myMR!=null) myMR.paint(pen);
    }
    

    private void keyReaction (int lastKeyPressed) {
        if(lastKeyPressed==KeyEvent.VK_1){
            
        }else if(lastKeyPressed==KeyEvent.VK_2){
            
        }else if(lastKeyPressed==KeyEvent.VK_3){
            
        }else if(lastKeyPressed==KeyEvent.VK_4){
            
        }else if(lastKeyPressed==KeyEvent.VK_V){
            
        }else if(lastKeyPressed==KeyEvent.VK_M){
            
        }else if(lastKeyPressed==KeyEvent.VK_G){
            
        }else if(lastKeyPressed==KeyEvent.VK_N){
            
        }else if(lastKeyPressed==KeyEvent.VK_C){
            
        }else if(lastKeyPressed==KeyEvent.VK_UP){
            
        }else if(lastKeyPressed==KeyEvent.VK_DOWN){
            
        }
    }
    
}
